Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update azurerm_api_management - Support more cipher options #9276

Merged
merged 19 commits into from
Jan 18, 2021

Conversation

flo-02-mu
Copy link
Contributor

Cipher options that can be disabled according to https://docs.microsoft.com/en-us/rest/api/apimanagement/2019-12-01/apimanagementservice/update#apimanagementserviceupdateparameters are added. As most of them are considered to be insecure, they are defaulting to false if not enabled.

@@ -294,6 +303,52 @@ func resourceArmApiManagementService() *schema.Resource {
Optional: true,
Default: false,
},

"enable_tls_ecdhe_ecdsa_with_aes256_cbc_sha_ciphers": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we put enabled on the end of all these properties? this is how we name booleans now:

Suggested change
"enable_tls_ecdhe_ecdsa_with_aes256_cbc_sha_ciphers": {
"tls_ecdhe_ecdsa_with_aes256_cbc_sha_ciphers_enabled": {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Note: I renamed also the one cipher that was already there (enable_triple_des_ciphers) to have at least all cipher flags consistent. Technically this is a breaking change then.

# Conflicts:
#	azurerm/internal/services/apimanagement/api_management_resource.go
@@ -291,7 +300,53 @@ func resourceArmApiManagementService() *schema.Resource {
Default: false,
},

"enable_triple_des_ciphers": {
Copy link
Contributor

@manicminer manicminer Nov 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flo-02-mu You can maintain compatibility by keeping the existing property, adding the Deprecated field, and checking for both in the expandApiManagementCustomProperties() function (preferring the new one).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added. Not sure if the d.GetOk(...) works for the nested block as expected though.

@flo-02-mu
Copy link
Contributor Author

@manicminer , @katbyte Any chance to get this one pushed?

@ghost ghost removed the waiting-response label Jan 11, 2021
@manicminer
Copy link
Contributor

@flo-02-mu If you can resolve the merge conflicts I'll take another look, thanks!

…flags

# Conflicts:
#	azurerm/internal/services/apimanagement/api_management_resource.go
@flo-02-mu
Copy link
Contributor Author

@flo-02-mu If you can resolve the merge conflicts I'll take another look, thanks!

@manicminer Sorry, I did not realize that. It's updated now.

Copy link
Contributor

@manicminer manicminer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flo-02-mu Thanks for that, this is mostly looking good. I've made some suggestions, some are necessary for the renamed property to work. Once these are addressed this should be good to merge.

Copy link
Contributor

@manicminer manicminer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @flo-02-mu, LGTM! Awaiting final test results and then we can merge this.

Copy link
Contributor

@manicminer manicminer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flo-02-mu The TestAccApiManagement_complete is now passing, however there's an issue with the APIM Consumption SKU which doesn't support custom ciphers. These likely need to be conditionally omitted from the request.

Error: creating/updating API Management Service "acctestAM-210114203058931793" (Resource Group "acctestRG-210114203058931793"): apimanagement.ServiceClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="NotSupported" Message="'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_GCM_SHA256,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_CBC_SHA,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_CBC_SHA256,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168' customProperties are not supported in SkuType Consumption."

@flo-02-mu
Copy link
Contributor Author

@flo-02-mu The TestAccApiManagement_complete is now passing, however there's an issue with the APIM Consumption SKU which doesn't support custom ciphers. These likely need to be conditionally omitted from the request.

Error: creating/updating API Management Service "acctestAM-210114203058931793" (Resource Group "acctestRG-210114203058931793"): apimanagement.ServiceClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="NotSupported" Message="'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_GCM_SHA256,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_CBC_SHA,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_CBC_SHA256,Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168' customProperties are not supported in SkuType Consumption."

@manicminer I included all cipher options inside the conditional SKU block. Where can I check the test results?

@ghost ghost removed the waiting-response label Jan 16, 2021
@manicminer
Copy link
Contributor

Thanks @flo-02-mu, this LGTM. I'm re-running the tests now; they aren't public at this time since we run them with private Azure credentials.

Copy link
Contributor

@manicminer manicminer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests passing (unrelated keyvault failures)

Screenshot 2021-01-18 at 11 50 58

@manicminer manicminer merged commit 5b6d78e into hashicorp:master Jan 18, 2021
manicminer added a commit that referenced this pull request Jan 18, 2021
@flo-02-mu flo-02-mu deleted the more-apim-cipher-flags branch January 18, 2021 21:25
@ghost
Copy link

ghost commented Jan 21, 2021

This has been released in version 2.44.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.44.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Feb 17, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Feb 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants